const { createProxyMiddleware } = require('http-proxy-middleware');
 
module.exports = function(app) {
  app.use(
    '/api',
    createProxyMiddleware({
      // target: 'http://www.beiyulake.com/api',
      target: 'http://localhost:8080/api',
      changeOrigin: true, // 确保主机头保持不变
      pathRewrite: {
        '^/api': '', // 重写请求路径
      },
    })
  );
};